package com.ruoyi.passenger.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.passenger.domain.TbPassengerCarOrder;
import com.ruoyi.passenger.service.ITbPassengerCarOrderService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 用户充值业务Controller
 * 
 * @author ruoyi
 * @date 2025-08-26
 */
@RestController
@RequestMapping("/orderstutas")
public class TbPassengerCarOrderController extends BaseController
{
    @Autowired
    private ITbPassengerCarOrderService tbPassengerCarOrderService;

    /**
     * 查询用户充值业务列表
     */
    //@RequiresPermissions("passenger:orderstutas:list")
    @GetMapping("/list")
    public TableDataInfo list(TbPassengerCarOrder tbPassengerCarOrder)
    {
        startPage();
        List<TbPassengerCarOrder> list = tbPassengerCarOrderService.selectTbPassengerCarOrderList(tbPassengerCarOrder);
        return getDataTable(list);
    }

    /**
     * 导出用户充值业务列表
     */
    //@RequiresPermissions("passenger:orderstutas:export")
    @Log(title = "用户充值业务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbPassengerCarOrder tbPassengerCarOrder)
    {
        List<TbPassengerCarOrder> list = tbPassengerCarOrderService.selectTbPassengerCarOrderList(tbPassengerCarOrder);
        ExcelUtil<TbPassengerCarOrder> util = new ExcelUtil<TbPassengerCarOrder>(TbPassengerCarOrder.class);
        util.exportExcel(response, list, "用户充值业务数据");
    }

    /**
     * 获取用户充值业务详细信息
     */
    //@RequiresPermissions("passenger:orderstutas:query")
    @GetMapping(value = "/{passengerId}")
    public AjaxResult getInfo(@PathVariable("passengerId") Long passengerId)
    {
        return success(tbPassengerCarOrderService.selectTbPassengerCarOrderByPassengerId(passengerId));
    }

    /**
     * 新增用户充值业务
     */
    //@RequiresPermissions("passenger:orderstutas:add")
    @Log(title = "用户充值业务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbPassengerCarOrder tbPassengerCarOrder)
    {
        return toAjax(tbPassengerCarOrderService.insertTbPassengerCarOrder(tbPassengerCarOrder));
    }

    /**
     * 修改用户充值业务
     */
    //@RequiresPermissions("passenger:orderstutas:edit")
    @Log(title = "用户充值业务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbPassengerCarOrder tbPassengerCarOrder)
    {
        return toAjax(tbPassengerCarOrderService.updateTbPassengerCarOrder(tbPassengerCarOrder));
    }

    /**
     * 删除用户充值业务
     */
    //@RequiresPermissions("passenger:orderstutas:remove")
    @Log(title = "用户充值业务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{passengerIds}")
    public AjaxResult remove(@PathVariable Long[] passengerIds)
    {
        return toAjax(tbPassengerCarOrderService.deleteTbPassengerCarOrderByPassengerIds(passengerIds));
    }
}
